/* ====================================
   布局样式模块 (layout.css)
   包含：应用容器、头部、侧边栏、主体布局
   ==================================== */

/* 应用主容器 */
.app-container { 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
}

/* 头部样式 */
.header { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    color: white; 
    padding: 1rem 2rem; 
    box-shadow: var(--box-shadow-md);
    position: relative;
    z-index: 100;
}

.header h1 { 
    font-size: 1.8rem; 
    font-weight: 600; 
    margin: 0;
}

/* 主内容区域 */
.main-content { 
    flex: 1; 
    display: flex; 
    min-height: 0; /* 防止flex子项溢出 */
}

/* 侧边栏导航 */
.sidebar { 
    width: 250px; 
    background: var(--color-background);
    box-shadow: 2px 0 10px rgba(0,0,0,0.1); 
    padding: 1rem 0;
    overflow-y: auto;
    flex-shrink: 0;
}

.menu-item { 
    display: block; 
    padding: 0.8rem 1.5rem; 
    color: var(--color-text-regular);
    cursor: pointer; 
    border-left: 3px solid transparent; 
    transition: all 0.3s;
    user-select: none;
    position: relative;
}

.menu-item:hover { 
    background-color: var(--color-background-light);
    color: var(--color-primary);
}

.menu-item.active { 
    background-color: #ecf5ff; 
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    font-weight: 500;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: var(--color-primary);
    border-radius: 50%;
}

/* 内容区域 */
.content-area { 
    flex: 1; 
    padding: 2rem; 
    overflow-y: auto;
    background: var(--color-background-light);
}

.page-title { 
    font-size: 1.5rem; 
    font-weight: 600; 
    color: var(--color-text-primary);
    margin-bottom: 1.5rem; 
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: 0.5rem; 
    position: relative;
}

.page-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 40px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 1px;
}

/* 内容头部和操作区域布局 */
.content-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.content-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-shrink: 0;
}

.content-actions .btn {
    margin: 0;
}

/* 页面加载状态 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-border-lighter);
    border-top: 4px solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 面包屑导航 */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 14px;
    color: var(--color-text-secondary);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-item:not(:last-child)::after {
    content: '/';
    color: var(--color-text-placeholder);
}

.breadcrumb-item.active {
    color: var(--color-text-primary);
    font-weight: 500;
}

/* 响应式布局调整 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        padding: 0.5rem 0;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    
    .menu-item {
        padding: 0.6rem 1rem;
    }
    
    .content-area {
        padding: 1rem;
    }
    
    .content-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .content-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .content-area {
        padding: 0.5rem;
    }
}